/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gc.java2flex.app;

import java.lang.reflect.Field;

/**
 *
 * @author venkks
 */
public class Java2Flex {

	public static void main(String args[]) {
		try {
			Class cls = org.emet.entity.biz.Carriage.class;
			String packageName = "org.emet.flex.web.dto";
			
			System.out.println("package " + packageName+ "{");
			System.out.println("import mx.collections.ArrayCollection;");
			System.out.println("import org.emet.flex.dto.BaseEntity;");
			System.out.println("[Bindable]");
			System.out.println("[RemoteClass(alias=\"" + cls.getName() + "\")]");
			System.out.println("public class " + cls.getSimpleName()
					+ " extends BaseEntity {");
			for (Field f : cls.getDeclaredFields()) {
				System.out.println("private var _" + f.getName() + ":" + FlexHelper.resolveSimpleAS3Name(f) + ";");
				System.out.println(" ");
			}

			for (Field f : cls.getDeclaredFields()) {
				String getter = "public function get " + f.getName() + "():" + FlexHelper.resolveSimpleAS3Name(f)
						+ " {return _" + f.getName() + ";}";
				String setter = "public function set " + f.getName() + "(value:" + FlexHelper.resolveSimpleAS3Name(f)
						+ "):void {_" + f.getName() + " = value;}";

				System.out.println(getter);
				System.out.println(setter);

			}

			System.out.println("}");
			System.out.println("}");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
